<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8"/>
    <title></title>
    <meta name="renderer" content="webkit"/>
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"/>
    <meta name="apple-mobile-web-app-status-bar-style" content="black"/>
    <meta name="apple-mobile-web-app-capable" content="yes"/>
    <meta name="format-detection" content="telephone=no"/>
    <link rel="stylesheet" href="/resource/common/layui/css/layui.css" media="all"/>
    <link href="/resource/css/index.css" rel="stylesheet" type="text/css"/>
</head>
<style>
    .longinput {
        width: 170%;
    }
</style>
<body class="index">

<div class="layui-form" action="" style="margin:auto;margin-top:30px">
    <div class="layui-row top">
        <div class="layui-col-md3">
            <div class="layui-form-item">
                <label class="layui-form-label">权限名称：</label>
                <div class="layui-input-inline">
                    <input id="permissionName" name="permissionName" lay-verify="required"
                           class="layui-input longinput"/>
                    <input id="parentId" name="parentId" hidden="hidden" th:value="${permission.permissionId}"/>
                </div>
            </div>
        </div>
        <div class="layui-col-md3">
            <div class="layui-form-item">
                <label class="layui-form-label">权限标识</label>
                <div class="layui-input-inline">
                    <input id="mark" value="" type="text" name="Mark" lay-verify="required"
                           th:value="${permission.permissionMark}" disabled="disabled"
                           class=" layui-input layui-disabled"/>
                </div>
                <div class="layui-input-inline">
                    <input id="markAdd" value="" type="text" name="Markadd" lay-verify="required" class="layui-input"
                           style="width: 123px"/>
                </div>
            </div>
        </div>
        <div class="layui-col-md3">
            <div class="layui-form-item">
                <label class="layui-form-label">类型</label>
                <div class="layui-input-inline" style="width: 323px">
                    <select id="permissionType" name="permissionType">
                        <option>subsystem</option>
                        <option>menu</option>
                        <option>button</option>
                    </select>
                </div>
            </div>
        </div>
        <div class="layui-col-md3">
            <div class="layui-form-item">
                <label class="layui-form-label">url</label>
                <div class="layui-input-inline">
                    <input id="url" name="url" class="layui-input longinput"/>
                </div>
            </div>
        </div>
        <div class="notice_bot">
            <div class="r_right but_p">
                <button class="but_save layui-btn" lay-submit="" lay-filter="Submit" style="padding: 0">保存
                </button>
                <button class="but_close" onclick="Cancel()">关闭</button>
            </div>
        </div>
    </div>
</div>
<script type="text/javascript" src="/resource/common/layui/layui.js"></script>
<script type="text/javascript" src=" /resource/js/user.js"></script>
<script type="text/javascript">

    var Cancel;
    layui.use(['table', 'layer', 'laydate', 'form'], function () {
        var table = layui.table,
            $ = layui.$,
            layer = layui.layer,
            form = layui.form;
        Cancel = function () {
            parent.layer.close(parent.layer.getFrameIndex(window.name));
        }
        form.on('submit(Submit)', function (data) {
            var mark = $("#mark").val() + ":"
            var addMark = $("#markAdd").val()
            data.field.permissionMark = mark + addMark;
            $.ajax({
                url: '/menu/addMenu.do',
                type: 'post',
                data: data.field,
                dataType: 'json',
                async: false,
                success: function (result) {
                    if (result.status) {
                        layer.msg("添加成功!", {time: 1000});
                        parent.layer.close(parent.layer.getFrameIndex(window.name));
                        parent.layui.table.reload('tableId', {});
                    } else {
                        layer.msg(result.msg);
                    }
                }

            });
        });
    });

</script>

</body>
</html>